package com.iflytek.application.common.resttemplate;

import lombok.RequiredArgsConstructor;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.web.client.RequestCallback;

import java.io.IOException;
import java.util.Collection;

/**
 * Created by guanxf on 2016-03-04.
 */
@RequiredArgsConstructor
public class CompositeRequestCallback implements RequestCallback {

    private final Collection<RequestCallback> callbacks;

    @Override
    public void doWithRequest(ClientHttpRequest request) throws IOException {
        for (RequestCallback callback : callbacks) {
            callback.doWithRequest(request);
        }
    }
}
